<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改业务员')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-salesman-edit" th:object="${salesman}">
            <input name="smNum" th:field="*{smNum}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">业务员名称：</label>
                <div class="col-sm-8">
                    <input name="smName" th:field="*{smName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">业务员电话：</label>
                <div class="col-sm-8">
                    <input name="smPhone" readonly th:field="*{smPhone}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">身份证：</label>
                <div class="col-sm-8">
                    <input name="screenIdnum"  th:field="*{screenIdnum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">结算卡：</label>
                <div class="col-sm-8">
                    <input name="screenNum"   th:field="*{screenNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">提成：</label>
                <div class="col-sm-8">
                    <input name="deduct"   th:field="*{deduct}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态</label>
                <div class="col-sm-8" th:if="*{smStatus+'' == '0'}">
                    <div class="radio-box">
                        <input type="radio" name="smStatus" value="0" checked="checked">
                        <label th:for="smStatus" th:text="正常"></label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="smStatus" value="1" >
                        <label th:for="smStatus" th:text="关闭"></label>
                    </div>
                </div>
                <div class="col-sm-8" th:if="*{smStatus+'' == '1'}">
                    <div class="radio-box">
                        <input type="radio" name="smStatus" value="0" >
                        <label th:for="smStatus" th:text="正常"></label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="smStatus" value="1"  checked="checked">
                        <label th:for="smStatus" th:text="关闭"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: utils-js" />
    <script th:inline="javascript">
        var prefix = ctx + "salesman/salesman";
        $("#form-salesman-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                if(!$.vali.valiPhone($("input[name='smPhone']").val())){
                    $.modal.msgError("请输入正确的手机号");
                    return;
                }
                $.operate.save(prefix + "/edit", $('#form-salesman-edit').serialize());
            }
        }
    </script>
</body>
</html>